home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / ov143b.zip / BIOSIO.ASM < prev    next >
Assembly Source File  |  1993-01-04  |  7KB  |  272 lines

  1.         PAGE   60,132
  2.         TITLE  Routines to do bios screen I/O
  3.  
  4. ;  004  27-May-87  biosio.asm
  5.  
  6. ;       Copyright (c) 1986,1987 by Blue Sky Software.  All rights reserved.
  7.  
  8.  
  9. _TEXT   SEGMENT  BYTE PUBLIC 'CODE'
  10. _TEXT   ENDS
  11. CONST   SEGMENT  WORD PUBLIC 'CONST'
  12. CONST   ENDS
  13. _BSS    SEGMENT  WORD PUBLIC 'BSS'
  14. _BSS    ENDS
  15. _DATA   SEGMENT  WORD PUBLIC 'DATA'
  16. _DATA   ENDS
  17.  
  18. DGROUP  GROUP   CONST,  _BSS,   _DATA
  19.         ASSUME  CS: _TEXT, DS: DGROUP, SS: DGROUP, ES: DGROUP
  20.  
  21. _DATA   SEGMENT
  22.         EXTRN   _vid_attrib:BYTE
  23. _DATA   ENDS
  24.  
  25. _TEXT      SEGMENT
  26.  
  27. ;******************************************************************************
  28. ;
  29. ;  getvideomode(width,page)       get the current video mode/width/page
  30. ;  int *width, *page;
  31. ;
  32. ;******************************************************************************
  33.  
  34.         PUBLIC _getvideomode
  35.  
  36. _getvideomode PROC NEAR
  37.         push   bp
  38.         mov    bp,sp
  39.  
  40.         mov    ah,0fh                  ; just use bios int 10h - 15
  41.         int    10h
  42.  
  43.         mov    cl,bh                   ; save page # (bh)
  44.         xor    ch,ch
  45.         mov    bx,[bp+6]               ; page pointer
  46.         mov    [bx],cx
  47.  
  48.         mov    cl,ah                   ; current width
  49.         mov    bx,[bp+4]               ; width pointer
  50.         mov    [bx],cx
  51.  
  52.         xor    ah,ah                   ; al already has the mode
  53.  
  54.         mov    sp,bp
  55.         pop    bp
  56.         ret
  57.  
  58. _getvideomode ENDP
  59.  
  60.  
  61. ;******************************************************************************
  62. ;
  63. ;  setvideomode(mode)             set the current video mode
  64. ;  int mode;
  65. ;
  66. ;******************************************************************************
  67.  
  68.         PUBLIC _setvideomode
  69.  
  70. _setvideomode PROC NEAR
  71.         push   bp
  72.         mov    bp,sp
  73.  
  74.         mov    ah,0                    ; just use bios int 10h - 0
  75.         mov    al,[bp+4]               ; low byte of mode
  76.         int    10h
  77.  
  78.         mov    sp,bp
  79.         pop    bp
  80.         ret
  81.  
  82. _setvideomode ENDP
  83.  
  84.  
  85. ;******************************************************************************
  86. ;
  87. ;  readcursor(page,row,col,stscan,endscan)  /* read cursor info */
  88. ;  int page;
  89. ;  int *row, *col, *stscan, *endscan;
  90. ;
  91. ;******************************************************************************
  92.  
  93.         PUBLIC _readcursor
  94.  
  95. _readcursor  PROC NEAR
  96.         push   bp
  97.         mov    bp,sp
  98.  
  99.         mov    ah,3                    ; just use bios int 10h - 3
  100.         mov    bh,[bp+4]               ; low byte of page
  101.         int    10h
  102.  
  103.         xor    ah,ah
  104.         mov    al,dh                   ; cursor row
  105.         mov    bx,[bp+6]
  106.         mov    [bx],ax
  107.  
  108.         mov    al,dl                   ; cursor column
  109.         mov    bx,[bp+8]
  110.         mov    [bx],ax
  111.  
  112.         mov    al,ch                   ; cursor start scan line
  113.         mov    bx,[bp+10]
  114.         mov    [bx],ax
  115.  
  116.         mov    al,cl                   ; cursor end scan line
  117.         mov    bx,[bp+12]
  118.         mov    [bx],ax
  119.  
  120.         mov    sp,bp
  121.         pop    bp
  122.         ret
  123.  
  124. _readcursor ENDP
  125.  
  126.  
  127. ;******************************************************************************
  128. ;
  129. ;  setcursorsize(startscan,endscan)   /* set cursor size */
  130. ;  int startscan, endscan;
  131. ;
  132. ;******************************************************************************
  133.  
  134.         PUBLIC _setcursorsize
  135.  
  136. _setcursorsize PROC   NEAR
  137.         push   bp
  138.         mov    bp,sp
  139.  
  140.         mov    ah,1                    ; just use DOS int 10h - 1
  141.         mov    ch,[bp+4]               ; starting scan line
  142.         mov    cl,[bp+6]               ; ending scan line
  143.         int    10h
  144.  
  145.         mov    sp,bp
  146.         pop    bp
  147.         ret
  148. _setcursorsize ENDP
  149.  
  150.  
  151. ;******************************************************************************
  152. ;
  153. ;  setdisplaypage(page)                /* set current display page # */
  154. ;  int page;
  155. ;
  156. ;******************************************************************************
  157.  
  158.         PUBLIC _setdisplaypage
  159.  
  160. _setdisplaypage PROC   NEAR
  161.         push   bp
  162.         mov    bp,sp
  163.  
  164.         mov    ah,5                    ; just use DOS int 10h - 5
  165.         mov    al,[bp+4]               ; wanted display page #
  166.         int    10h
  167.  
  168.         mov    sp,bp
  169.         pop    bp
  170.         ret
  171. _setdisplaypage ENDP
  172.  
  173.  
  174. ;******************************************************************************
  175. ;
  176. ;  getraw()       get a char from console without ^C checking
  177. ;
  178. ;******************************************************************************
  179.  
  180.         PUBLIC _getraw
  181.  
  182. _getraw PROC   NEAR
  183.         push   bp
  184.         mov    bp,sp
  185.  
  186.         mov    ah,7                    ; just use DOS int 21h - 7
  187.         int    21h
  188.         xor    ah,ah
  189.  
  190.         mov    sp,bp
  191.         pop    bp
  192.         ret
  193. _getraw ENDP
  194.  
  195.  
  196. ;******************************************************************************
  197. ;
  198. ;  putchr(ch)  put char to console in TTY mode with current video attribute
  199. ;
  200. ;******************************************************************************
  201.  
  202.         PUBLIC _putchr
  203.  
  204. _putchr PROC   NEAR
  205.         push   bp
  206.         mov    bp,sp
  207.  
  208.         mov    ah,0Eh                  ; do a write TTY call (updates cursor)
  209.         mov    al,[bp+4]               ; char to write
  210.         int    10h
  211.  
  212.         mov    sp,bp
  213.         pop    bp
  214.         ret
  215. _putchr ENDP
  216.  
  217.  
  218. ;******************************************************************************
  219. ;
  220. ;  peekchr()      peek a char from console without removing from buffer
  221. ;
  222. ;******************************************************************************
  223.  
  224.         PUBLIC _peekchr
  225.  
  226. _peekchr PROC  NEAR
  227.         push   bp
  228.         mov    bp,sp
  229.  
  230.         mov    ah,1                    ; just use BIOS int 16h - 1
  231.         int    16h
  232.         jz     nochr                   ; Z means no char waiting
  233.  
  234.         xor    ah,ah                   ; got a char in al, clr ah
  235.         jmp    SHORT peekret
  236.  
  237. nochr:  xor    ax,ax                   ; tell caller no char
  238.  
  239. peekret: mov   sp,bp
  240.         pop    bp
  241.         ret
  242.  
  243. _peekchr ENDP
  244.  
  245.  
  246. ;******************************************************************************
  247. ;
  248. ;  getverify()     get DOS verify flag
  249. ;
  250. ;******************************************************************************
  251.  
  252.         PUBLIC _getverify
  253.  
  254. _getverify PROC  NEAR
  255.  
  256.         push   bp
  257.         mov    bp,sp
  258.  
  259.         mov    ah,54h                  ; get DOS verify flag
  260.         int    21h
  261.  
  262.         xor    ah,ah                   ; returned in AL, clear AH
  263.  
  264.         mov    sp,bp
  265.         pop    bp
  266.         ret
  267.  
  268. _getverify ENDP
  269.  
  270. _TEXT   ENDS
  271.         END
  272.